package day6.supermarket;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class TestMarket {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Market market = new Market();
        market.name = "合家福马鞍山路店";
        market.adress = "马鞍山路50号";

        int choice = 0;

        while (true) {


            System.out.println("1:新会员办卡,2:查看信息，3:兑换,4:涨积分,5另一种增加，9：退出");
            choice = in.nextInt();
            if (choice == 1) {

                System.out.println("请输入会员的卡号:");
                String cardNo = in.next();
                System.out.println("请输入会员的手机号:");
                String phone = in.next();
                System.out.println("请输入会员的姓名:");
                String name = in.next();
                System.out.println("请输入会员的积分:");
                int f = in.nextInt();
                Card c = new Card(f, name, cardNo, phone);
                //                c.number=cardNo;
                //                c.tell=phone;
                //                c.jf=f;
                //                c.name=name;
                boolean add = market.add(c);
                System.out.println(add?"开卡成功":"开卡失败！");
            } else if (choice == 2) {
                market.show();
            } else if (choice == 3) {
                System.out.println("换什么？1：餐巾纸1包，100分2:剃须刀一把400分3:炒锅一个1000分：");
                int type = in.nextInt();
                System.out.println("会员号：");
                String no = in.next();
                String ex = market.exchangeGift(no, type);
                if (ex == null) {
                    System.out.println("没有兑换成功");
                } else {
                    System.out.println("成功兑换了" + ex);
                }
            } else if (choice == 4) {
                System.out.println("给那个会员涨：");
                String no = in.next();
                System.out.println("涨多少");
                int s = in.nextInt();
                market.increase(no, s);
            } else if (choice == 5) {
                System.out.println("请输入会员的卡号:");
                String cardNo = in.next();
                System.out.println("请输入会员的手机号:");
                String phone = in.next();
                System.out.println("请输入会员的姓名:");
                String name = in.next();
                System.out.println("请输入会员的积分:");
                int f = in.nextInt();
                boolean addok=market.add(f,name,cardNo,phone);
                System.out.println("增加的结果是"+addok);
            }else if (choice == 9) {
                break;
            }
        }
    }
}
